package com.itlong.cloud.property.service.impl;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.itlong.cloud.POJO.DTO.property.*;
import com.itlong.cloud.POJO.PO.*;
import com.itlong.cloud.POJO.VO.property.PropertyProjectRoomInfoVO;
import com.itlong.cloud.PlatformConstants;
import com.itlong.cloud.constants.RabbitMQConstant;
import com.itlong.cloud.enumerate.CloudElevatorChangeBusinessEnum;
import com.itlong.cloud.enumerate.DataStatusEnum;
import com.itlong.cloud.enumerate.ImportAddressOperationType;
import com.itlong.cloud.enumerate.SmartCommunityEnum;
import com.itlong.cloud.property.dao.IPropertyBuildInfoDao;
import com.itlong.cloud.property.dao.IPropertyRoomInfoDao;
import com.itlong.cloud.property.dao.IPropertyUnitInfoDao;
import com.itlong.cloud.property.service.IPropertyAddressInfoService;
import com.itlong.cloud.rabbitmq.config.MessageSender;
import com.itlong.cloud.utils.data.handler.SqlUtil;
import com.itlong.cloud.utils.node.JsonUtil;
import com.itlong.cloud.utils.words.NumberHandlerUtil;
import com.itlong.cloud.utils.words.StringHandlerUtil;
import org.slf4j.Logger;import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * <desc>
 *      地址信息处理接口实现（如导入、导出）.
 * </desc>
 *
 * @createDate 2017-10-17
 */
@Service
public class PropertyAddressInfoServiceImpl implements IPropertyAddressInfoService {

    private static final Logger LOG = LoggerFactory.getLogger(PropertyAddressInfoServiceImpl.class); //日志对象

    private static ExecutorService importAddressFixedThreadPool = Executors.newFixedThreadPool(12); //导入地址的线程池

    private final IPropertyRoomInfoDao iPropertyRoomInfoDao; //房屋信息数据库访问对象

    private final IPropertyUnitInfoDao iPropertyUnitInfoDao; //单元信息数据库访问对象

    private final IPropertyBuildInfoDao iPropertyBuildInfoDao; //楼栋信息数据库访问对象

    private final MessageSender messageSender; //RabitMQ发送

    @Autowired
    public PropertyAddressInfoServiceImpl(IPropertyRoomInfoDao iPropertyRoomInfoDao, IPropertyUnitInfoDao iPropertyUnitInfoDao,
                                          IPropertyBuildInfoDao iPropertyBuildInfoDao, MessageSender messageSender) {
        this.iPropertyRoomInfoDao = iPropertyRoomInfoDao;
        this.iPropertyUnitInfoDao = iPropertyUnitInfoDao;
        this.iPropertyBuildInfoDao = iPropertyBuildInfoDao;
        this.messageSender = messageSender;
    }


    /**
     * <desc>
     *      保存通过Excel文件导入的地址信息
     * </desc>
     *
     * @param propertyProjectSaveImportAddressDTO 从Excel(*.xls)导入地址信息数据传输对象(含楼栋列表、单元列表、房间列表,用于保存到数据库)
     * @return 受影响的行数
     * @author LouisLewis
     * @createDate 2017-10-12
     */
    @Override
    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
    public Integer saveImportAddressInfo(PropertyProjectSaveImportAddressDTO propertyProjectSaveImportAddressDTO) throws Exception {

        importAddressFixedThreadPool.execute(()-> {
                try {
                    //保存更新楼栋信息
                    saveImportBuildInfo(propertyProjectSaveImportAddressDTO);

                    //保存更新单元信息
                    saveImportUnitInfo(propertyProjectSaveImportAddressDTO);

                    //保存更新房屋信息
                    saveImportRoomInfo(propertyProjectSaveImportAddressDTO);

                    //向RabbitMQ发送云对讲更新信息
                    sendMsgToRabbitMQForInterCom(propertyProjectSaveImportAddressDTO);

                } catch (Exception e) {
                    LOG.error("导入地址信息失败", e);
                }

        });

        return propertyProjectSaveImportAddressDTO.getAddressInfosInFile().size();
    }


    /**
     * <desc>
     *      按楼栋Id列表查询房间信息(用于导出)
     * </desc>
     *
     * @param propertyProjectImportAddressExtraDataDTO 楼栋Id列表
     * @return 房屋信息列表
     * @author LouisLewis
     * @createDate 2017-10-16
     */
    @Override
    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    public List<PropertyProjectRoomInfoVO> getExportAddressInfo(PropertyProjectExportAddressesDTO propertyProjectImportAddressExtraDataDTO) {
        String[] buildIds = StringHandlerUtil.splitString(propertyProjectImportAddressExtraDataDTO.getBuildIds());
        return iPropertyRoomInfoDao.getRoomInfoByBuildIds(propertyProjectImportAddressExtraDataDTO.getProjectId(), buildIds);
    }


    /**
    * <desc>
    *       保存更新导入的楼栋信息.
    * </desc>
    *
    * @param propertyProjectSaveImportAddressDTO 从Excel(*.xls)导入地址信息数据传输对象(含楼栋列表、单元列表、房间列表,用于保存到数据库)
    * @author LewisLouis
    * @createDate 2017-10-23
    */
    private void saveImportBuildInfo(PropertyProjectSaveImportAddressDTO propertyProjectSaveImportAddressDTO) throws Exception {
        //取出导入的楼栋信息列表
        Map<String, PropertyProjectImportBuildInfoDTO> buildInfoPOInFileMap = propertyProjectSaveImportAddressDTO.getAddressInfosInFile();
        List<Map<String, Object>> saveBuildList = new ArrayList<>(); //定义需保存的楼栋列表
        List<Map<String, Object>> updateBuildList = new ArrayList<>(); //定义需修改的楼栋列表

        //依次遍历导入的楼栋列表，检查每个待导入的楼栋应该执行的操作类型，进行分类处理
        for (Map.Entry<String, PropertyProjectImportBuildInfoDTO> buildInfoEntry : buildInfoPOInFileMap.entrySet()) {
            PropertyProjectImportBuildInfoDTO propertyProjectImportBuildInfoDTO = buildInfoEntry.getValue();
            BuildInfoPO buildInfoPO = new BuildInfoPO();
            BeanUtils.copyProperties(propertyProjectImportBuildInfoDTO, buildInfoPO);
            if (propertyProjectImportBuildInfoDTO.getImportAddressOperationType().equals(ImportAddressOperationType.ADD)) {
                buildInfoPO.setStatus(DataStatusEnum.NORMAL.getType());
                Date createTime = new Date();
                buildInfoPO.setCreateTime(createTime);
                buildInfoPO.setUpdateTime(createTime);
                saveBuildList.add(SqlUtil.durableData(buildInfoPO, PlatformConstants.TABLE_SAVE));
            } else if (propertyProjectImportBuildInfoDTO.getImportAddressOperationType().equals(ImportAddressOperationType.UPDATE)){
                Date updateTime = new Date();
                buildInfoPO.setUpdateTime(updateTime);
                buildInfoPO.setBuildNum(null); //不更新楼栋编号
                buildInfoPO.setBuildName(null); //导入操作不可能更新楼栋名称
                updateBuildList.add(SqlUtil.durableData(buildInfoPO, PlatformConstants.TABLE_UPDATE));
            }
        }
        if (!saveBuildList.isEmpty()) {   //进行楼栋信息的批量保存
            iPropertyBuildInfoDao.batchSave(saveBuildList);
        }
        if (!updateBuildList.isEmpty()) {  //进行楼栋信息的批量修改
            iPropertyBuildInfoDao.batchUpdate(updateBuildList);
        }
    }

    /**
     * <desc>
     *      保存更新导入的单元信息.
     * </desc>
     *
     * @param propertyProjectSaveImportAddressDTO 从Excel(*.xls)导入地址信息数据传输对象(含楼栋列表、单元列表、房间列表,用于保存到数据库)
     * @author LewisLouis
     * @createDate 2017-10-23
     */
    private void saveImportUnitInfo(PropertyProjectSaveImportAddressDTO propertyProjectSaveImportAddressDTO) throws Exception {
        //取出导入的单元信息列表
       // Map<String, Map<String, PropertyProjectImportUnitInfoDTO>> unitInfoPOInFileMap = propertyProjectSaveImportAddressDTO.getUnitInfoPOSInFile();
        List<Map<String, Object>> saveUnitList = new ArrayList<>(); //定义需保存的单元列表
        List<Map<String, Object>> updateUnitList = new ArrayList<>(); //定义需修改的单元列表

        //依次遍历导入的每个楼栋的单元列表，检查每个待导入的单元应该执行的操作类型，进行分类处理
        Map<String, PropertyProjectImportBuildInfoDTO> buildInfoPOSInFile = propertyProjectSaveImportAddressDTO.getAddressInfosInFile();
        // 单元权限组号逻辑
        Integer unitGroupNum = iPropertyUnitInfoDao.getMaxUnitGroupNum(propertyProjectSaveImportAddressDTO.getProjectId());
        List<String> list = iPropertyUnitInfoDao.getUnitGroupNumGroupCountMap(propertyProjectSaveImportAddressDTO.getProjectId());
        Map<String,Integer> map = new HashMap<>();
        for (String str : list){
            String[] split = str.split(",");
            map.put(split[0],new Integer(split[1]));
        }
        if (unitGroupNum == null) {
            unitGroupNum = 1;
        } else {
            if (unitGroupNum < 99) {
                unitGroupNum += 1;
            } else {
                // 单元会有删除的情况，会导致项目下单元组号被删的错乱不堪，要从头补起
                unitGroupNum = 1;
                for (int i = 2; i <= 99; i++) {
                    int ii = map.get(NumberHandlerUtil.numFormatToString(i, 2)) == null ? 0 : map.get(NumberHandlerUtil.numFormatToString(i, 2));
                    int iiBefore = map.get(NumberHandlerUtil.numFormatToString((i - 1), 2)) == null ? 0 : map.get(NumberHandlerUtil.numFormatToString((i - 1), 2));
                    if (ii < iiBefore) {
                        unitGroupNum = i;
                        break;
                    }
                    if (ii > iiBefore) {
                        unitGroupNum = i - 1;
                        break;
                    }
                }
            }
        }
        for (Map.Entry<String, PropertyProjectImportBuildInfoDTO> oneBuildEntry : buildInfoPOSInFile.entrySet()) {
            PropertyProjectImportBuildInfoDTO oneBuildInFile = oneBuildEntry.getValue();
            //遍历当前楼栋下的单元
            Map<String, PropertyProjectImportUnitInfoDTO> unitInfoPOSInOneBuildInFile = oneBuildInFile.getUnitsInFile();
            for (Map.Entry<String, PropertyProjectImportUnitInfoDTO> oneUnitEntry : unitInfoPOSInOneBuildInFile.entrySet()) {
                PropertyProjectImportUnitInfoDTO oneUnitInFile = oneUnitEntry.getValue();
                UnitInfoPO unitInfoPO = new UnitInfoPO();
                BeanUtils.copyProperties(oneUnitInFile,unitInfoPO);
                if (oneUnitInFile.getImportAddressOperationType().equals(ImportAddressOperationType.ADD)) {
                    unitInfoPO.setStatus(DataStatusEnum.NORMAL.getType());
                    Date createTime = new Date();
                    unitInfoPO.setCreateTime(createTime);
                    unitInfoPO.setUpdateTime(createTime);
                    int thisUnitGroupNum = unitGroupNum + saveUnitList.size();
                    unitInfoPO.setUnitGroupNum(NumberHandlerUtil.numFormatToString((thisUnitGroupNum % 99) == 0 ? 99 : (thisUnitGroupNum % 99),2));
                    saveUnitList.add(SqlUtil.durableData(unitInfoPO, PlatformConstants.TABLE_SAVE));
                } else if (oneUnitInFile.getImportAddressOperationType().equals(ImportAddressOperationType.UPDATE)){
                    Date updateTime = new Date();
                    unitInfoPO.setUpdateTime(updateTime);
                    unitInfoPO.setUnitName(null);//导入操作无法更新单元名称
                    unitInfoPO.setUnitNum(null); //不更新单元编号
                    unitInfoPO.setBuildId(null); //导入操作无法更新单元所属楼栋id
                    updateUnitList.add(SqlUtil.durableData(unitInfoPO, PlatformConstants.TABLE_UPDATE));
                }
            }
        }
        if (!saveUnitList.isEmpty()) {   //进行所有楼栋下单元信息的批量保存
            iPropertyUnitInfoDao.batchSave(saveUnitList);
        }
        if (!updateUnitList.isEmpty()) {  //进行所有楼栋下单元信息的批量修改
            iPropertyUnitInfoDao.batchUpdate(updateUnitList);
        }
    }

    /**
     * <desc>
     *      保存更新导入的房屋信息.
     * </desc>
     *
     * @param propertyProjectSaveImportAddressDTO 从Excel(*.xls)导入地址信息数据传输对象(含楼栋列表、单元列表、房间列表,用于保存到数据库)
     * @author LewisLouis
     * @createDate 2017-10-23
     */
    private void saveImportRoomInfo(PropertyProjectSaveImportAddressDTO propertyProjectSaveImportAddressDTO) throws Exception {

        //取出导入的房屋信息列表
        List<Map<String, Object>> saveRoomList = new ArrayList<>(); //定义需保存的房屋列表
        List<Map<String, Object>> updateRoomList = new ArrayList<>(); //定义需修改的房屋列表

        //通过项目编号查询该项目类型
        String projectType = iPropertyRoomInfoDao.getProjectTypeByProjectId(propertyProjectSaveImportAddressDTO.getProjectId());

        //遍历每个楼栋，逐楼栋处理单元下的房屋信息
        Map<String, PropertyProjectImportBuildInfoDTO> buildInfoPOSInFile = propertyProjectSaveImportAddressDTO.getAddressInfosInFile();
        for (Map.Entry<String, PropertyProjectImportBuildInfoDTO> oneBuildEntry : buildInfoPOSInFile.entrySet()) {
            PropertyProjectImportBuildInfoDTO oneBuildInFile = oneBuildEntry.getValue();
            //遍历当前楼栋下的单元
            Map<String, PropertyProjectImportUnitInfoDTO> unitInfoPOSInOneBuildInFile = oneBuildInFile.getUnitsInFile();
            for (Map.Entry<String, PropertyProjectImportUnitInfoDTO> oneUnitEntry : unitInfoPOSInOneBuildInFile.entrySet()) {
                PropertyProjectImportUnitInfoDTO oneUnitInFile = oneUnitEntry.getValue();
                JSONArray roomsInOneUnitNeedNotifyIntercom = new JSONArray();

                //遍历当前单元下的房间
                Map<String, PropertyProjectImportRoomInfoDTO> roomInfoPOSInOneUnitInFile = oneUnitInFile.getRoomsInFile();
                for (Map.Entry<String, PropertyProjectImportRoomInfoDTO> oneRoomEntry : roomInfoPOSInOneUnitInFile.entrySet()) {
                    PropertyProjectImportRoomInfoDTO oneRoomInFile = oneRoomEntry.getValue();
                    RoomInfoPO roomInfoPO = new RoomInfoPO();
                    BeanUtils.copyProperties(oneRoomInFile,roomInfoPO);
                    if(projectType.equals("2")){
                        roomInfoPO.setRoomType(3);
                    }
                    if (oneRoomInFile.getImportAddressOperationType().equals(ImportAddressOperationType.ADD)) {
                        roomInfoPO.setStatus(DataStatusEnum.NORMAL.getType());
                        Date createTime = new Date();
                        roomInfoPO.setRoomName(roomInfoPO.getRoomNum());
                        roomInfoPO.setCreateTime(createTime);
                        roomInfoPO.setUpdateTime(createTime);
                        saveRoomList.add(SqlUtil.durableData(roomInfoPO, PlatformConstants.TABLE_SAVE));
                    } else if (oneRoomInFile.getImportAddressOperationType().equals(ImportAddressOperationType.UPDATE)){
                        //当前待导入到房屋信息在数据库中已存在,则加入到修改列表中稍后执行批量修改
                        Date createTime = new Date();
                        roomInfoPO.setUpdateTime(createTime);
                        roomInfoPO.setRoomNum(null); //不更新房屋编号
                        updateRoomList.add(SqlUtil.durableData(roomInfoPO, PlatformConstants.TABLE_UPDATE));
                    }


                    if (saveRoomList.size() > 500) {   //每超过N条提交一次批量保存
                        iPropertyRoomInfoDao.batchSave(saveRoomList);
                        saveRoomList.clear();
                    }
                    if (updateRoomList.size() > 500) {  //每超过N条提交一次批量更新
                        iPropertyRoomInfoDao.batchUpdate(updateRoomList);
                        updateRoomList.clear();
                    }
                }
            }
        }

        if (!saveRoomList.isEmpty()) {   //将剩余的进行一次批量保存
            iPropertyRoomInfoDao.batchSave(saveRoomList);
            saveRoomList.clear();
        }
        if (!updateRoomList.isEmpty()) {  //将剩余的进行一次批量更新
            iPropertyRoomInfoDao.batchUpdate(updateRoomList);
            updateRoomList.clear();
        }
    }


    /**
    * <desc>
    *     向RbbitMQ发送云对讲更新信息.
    * </desc>
    *
    * @param  propertyProjectSaveImportAddressDTO
    * @author LewisLouis
    * @createDate 2017-11-30
    */
    private void sendMsgToRabbitMQForInterCom(PropertyProjectSaveImportAddressDTO propertyProjectSaveImportAddressDTO) throws Exception{


        List<DeviceBusinessChangeLogPO> deviceBusinessChangeLogPOS  = new ArrayList<>();;
        List<DeviceBusinessElevatorChangeLogPO> deviceElevatorChangeLogPOS = new ArrayList<>();
        //遍历每个楼栋，逐楼栋处理楼栋下的房屋信息
        Map<String, PropertyProjectImportBuildInfoDTO> buildInfoPOSInFile = propertyProjectSaveImportAddressDTO.getAddressInfosInFile();
        for (Map.Entry<String, PropertyProjectImportBuildInfoDTO> oneBuildEntry : buildInfoPOSInFile.entrySet()) {
            PropertyProjectImportBuildInfoDTO oneBuildInFile = oneBuildEntry.getValue();
            //遍历当前楼栋下的单元
            Map<String, PropertyProjectImportUnitInfoDTO> unitInfoPOSInOneBuildInFile = oneBuildInFile.getUnitsInFile();
            for (Map.Entry<String, PropertyProjectImportUnitInfoDTO> oneUnitEntry : unitInfoPOSInOneBuildInFile.entrySet()) {
                PropertyProjectImportUnitInfoDTO oneUnitInFile = oneUnitEntry.getValue();
                JSONArray roomsInOneUnitNotifyIntercom = new JSONArray();
                if (oneUnitInFile.getNeedNotifyIntercom()){
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("projectId",propertyProjectSaveImportAddressDTO.getProjectId());
                    DeviceBusinessChangeLogPO deviceBusinessChangeLogPO
                            = new DeviceBusinessChangeLogPO(SmartCommunityEnum.PUSH_FULL,jsonObject,propertyProjectSaveImportAddressDTO.getProjectId());
                    deviceBusinessChangeLogPOS.clear();
                    deviceElevatorChangeLogPOS.clear();
                    deviceBusinessChangeLogPOS.add(deviceBusinessChangeLogPO);
                    deviceElevatorChangeLogPOS.add(new DeviceBusinessElevatorChangeLogPO(propertyProjectSaveImportAddressDTO.getProjectId(),
                            CloudElevatorChangeBusinessEnum.PUSH_ROOM_FULL,jsonObject.toJSONString()));
                    JSONObject dataJs = new JSONObject();
                    dataJs.put("data",deviceBusinessChangeLogPOS);
                    //云对讲业务指令
                    messageSender.send(RabbitMQConstant.RABBITMQ_HANDLE_SMART_COMMUNITY_ORDERS_QUEUE,
                            JsonUtil.toJSON(dataJs), RabbitMQConstant.RABBITMQ_SMART_COMMUNITY_ORDERS_EXCHANGE,
                            RabbitMQConstant.RABBITMQ_SMART_COMMUNITY_ORDERS_ROUTING_KEY);
                    //云电梯业务指令
                    dataJs.put("data",deviceElevatorChangeLogPOS);
                    messageSender.send(
                            RabbitMQConstant.RABBITMQ_HANDLE_CLOUD_ELEVATOR_CHANGE_BUSINESS_QUEUE,
                            JsonUtil.toJSON(dataJs),
                            RabbitMQConstant.RABBITMQ_CLOUD_ELEVATOR_CHANGE_BUSINESS_EXCHANGE,
                            RabbitMQConstant.RABBITMQ_CLOUD_ELEVATOR_CHANGE_BUSINESS_ROUTING_KEY);
                    return;  //有任意单元导致全量更新，则无需再继续下去
                }

                //遍历当前单元下的房间
                Map<String, PropertyProjectImportRoomInfoDTO> roomInfoPOSInOneUnitInFile = oneUnitInFile.getRoomsInFile();
                for (Map.Entry<String, PropertyProjectImportRoomInfoDTO> oneRoomEntry : roomInfoPOSInOneUnitInFile.entrySet()) {
                    PropertyProjectImportRoomInfoDTO oneRoomInFile = oneRoomEntry.getValue();
                    if (oneRoomInFile.getNeedNotifyIntercom()) {
                        JSONObject oneRoomNeedNotifyIntercom = new JSONObject();
                        oneRoomNeedNotifyIntercom.put("roomId", oneRoomInFile.getRoomId());
                        roomsInOneUnitNotifyIntercom.add(oneRoomNeedNotifyIntercom);
                    }
                }

                //针对单个单元，需要通知云对讲的房间每50个进行一次提交
                JSONArray roomsNotifyIntercomOneBatch = new JSONArray();
                for(int roomIndex = 0; roomIndex < roomsInOneUnitNotifyIntercom.size();roomIndex++){

                    JSONObject jsonObject = roomsInOneUnitNotifyIntercom.getJSONObject(roomIndex);
                    roomsNotifyIntercomOneBatch.add(jsonObject);
                    if (roomsNotifyIntercomOneBatch.size() >= 50){
                        DeviceBusinessChangeLogPO deviceBusinessChangeLogPO
                                = new DeviceBusinessChangeLogPO(SmartCommunityEnum.PUSH_ROOM, roomsNotifyIntercomOneBatch, propertyProjectSaveImportAddressDTO.getProjectId());
                        deviceBusinessChangeLogPOS.add(deviceBusinessChangeLogPO);
                        deviceElevatorChangeLogPOS.add(new DeviceBusinessElevatorChangeLogPO(propertyProjectSaveImportAddressDTO.getProjectId(),
                                CloudElevatorChangeBusinessEnum.PUSH_ROOM_PWD,roomsNotifyIntercomOneBatch.toJSONString()));
                        roomsNotifyIntercomOneBatch.clear();
                    }
                }

                //不足50个的部分需要单独提交
                if (!roomsNotifyIntercomOneBatch.isEmpty()){
                    DeviceBusinessChangeLogPO deviceBusinessChangeLogPO
                            = new DeviceBusinessChangeLogPO(SmartCommunityEnum.PUSH_ROOM, roomsNotifyIntercomOneBatch, propertyProjectSaveImportAddressDTO.getProjectId());
                    deviceBusinessChangeLogPOS.add(deviceBusinessChangeLogPO);
                    deviceElevatorChangeLogPOS.add(new DeviceBusinessElevatorChangeLogPO(propertyProjectSaveImportAddressDTO.getProjectId(),
                            CloudElevatorChangeBusinessEnum.PUSH_ROOM_PWD,roomsNotifyIntercomOneBatch.toJSONString()));
                    roomsNotifyIntercomOneBatch.clear();
                }
            }
        }


        //所有信息，一次批量提交
        JSONObject dataJs = new JSONObject();
        //云对讲
        dataJs.put("data",deviceBusinessChangeLogPOS);
        messageSender.send(RabbitMQConstant.RABBITMQ_HANDLE_SMART_COMMUNITY_ORDERS_QUEUE,
                JsonUtil.toJSON(dataJs), RabbitMQConstant.RABBITMQ_SMART_COMMUNITY_ORDERS_EXCHANGE,
                RabbitMQConstant.RABBITMQ_SMART_COMMUNITY_ORDERS_ROUTING_KEY);
        //云电梯
        dataJs.put("data",deviceElevatorChangeLogPOS);
        messageSender.send(
                RabbitMQConstant.RABBITMQ_HANDLE_CLOUD_ELEVATOR_CHANGE_BUSINESS_QUEUE,
                JsonUtil.toJSON(dataJs),
                RabbitMQConstant.RABBITMQ_CLOUD_ELEVATOR_CHANGE_BUSINESS_EXCHANGE,
                RabbitMQConstant.RABBITMQ_CLOUD_ELEVATOR_CHANGE_BUSINESS_ROUTING_KEY);
    }
}
